import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

/**
 * 线性布局
 */

class PaddingWidget extends StatelessWidget {
  PaddingWidget({
    Key ?key,
    @required this.text,
  }) : super(key: key);
  final String ? text;

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
        appBar: AppBar(
          title: Text(text??""),
        ),
        body: Container(
          padding: EdgeInsets.only(left: 28.0, top: 80.0, right: 28.0),
          child: Padding(
            //上下左右各添加16像素补白
            padding: EdgeInsets.all(16.0),
            child: Column(
              //显式指定对齐方式为左对齐，排除对齐干扰
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Padding(
                  //左边添加8像素补白
                  padding: const EdgeInsets.only(left: 8.0),
                  child: Text("Hello world"),
                ),
                Padding(
                  //上下各添加8像素补白
                  padding: const EdgeInsets.symmetric(vertical: 8.0),  //左右不添加
                  child: Text("I am Jack"),
                ),
                Padding(
                  // 分别指定四个方向的补白
                  padding: const EdgeInsets.fromLTRB(20.0, .0, 20.0, 20.0),
                  child: Text("Your friend"),
                )
              ],
            ),
          ),
        ));
  }
}
